package com.wsoft.bpm.listener.task;

import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 设置任务的流程变量监听器
 *
 * @Author zhonglj
 * @Date 2025/1/10 8:39
 */
@Service
public class TaskVariableSetterListener implements TaskListener {
    @Resource
    private TaskService taskService;

    @Override
    public void notify(DelegateTask delegateTask) {
        //todo 获取流程变量，从页面配置获取

        // 设置到当前任务的本地变量
        taskService.setVariableLocal(delegateTask.getId(), "name", "value");
    }
}
